- @no_container = true
= render "admin/dashboard/head"

%div{ class: container_class }
  .admin-dashboard.prepend-top-default
    .row
      .col-md-4
        %h4 统计
        %hr
        %p
          派生
          %span.light.pull-right
            = number_with_delimiter(ForkedProjectLink.count)
        %p
          问题
          %span.light.pull-right
            = number_with_delimiter(Issue.count)
        %p
          合并请求
          %span.light.pull-right
            = number_with_delimiter(MergeRequest.count)
        %p
          笔记
          %span.light.pull-right
            = number_with_delimiter(Note.count)
        %p
          代码片段
          %span.light.pull-right
            = number_with_delimiter(Snippet.count)
        %p
          SSH 密钥
          %span.light.pull-right
            = number_with_delimiter(Key.count)
        %p
          里程碑
          %span.light.pull-right
            = number_with_delimiter(Milestone.count)
        %p
          活跃用户
          %span.light.pull-right
            = number_with_delimiter(User.active.count)
      .col-md-4
        %h4
          功能
        %hr
        %p
          注册
          %span.light.pull-right
            = boolean_to_icon signup_enabled?
        %p
          LDAP
          %span.light.pull-right
            = boolean_to_icon Gitlab.config.ldap.enabled
        %p
          头像
          %span.light.pull-right
            = boolean_to_icon gravatar_enabled?
        %p
          OmniAuth
          %span.light.pull-right
            = boolean_to_icon Gitlab.config.omniauth.enabled
        %p
          邮件回复
          %span.light.pull-right
            = boolean_to_icon Gitlab::IncomingEmail.enabled?
      .col-md-4
        %h4
          组件
          - if current_application_settings.version_check_enabled
            .pull-right
              = version_status_badge

        %hr
        %p
          GitLab
          %span.pull-right
            = Gitlab::VERSION
        %p
          GitLab Shell
          %span.pull-right
            = Gitlab::Shell.new.version
        %p
          GitLab API
          %span.pull-right
            = API::API::version
        %p
          Git
          %span.pull-right
            = Gitlab::Git.version
        %p
          Ruby
          %span.pull-right
            #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}

        %p
          Rails
          %span.pull-right
            #{Rails::VERSION::STRING}

        %p
          = Gitlab::Database.adapter_name
          %span.pull-right
            = Gitlab::Database.version
    %hr
    .row
      .col-sm-4
        .light-well
          %h4 项目
          .data
            = link_to admin_namespaces_projects_path do
              %h1= number_with_delimiter(Project.cached_count)
            %hr
            = link_to('新建项目', new_project_path, class: "btn btn-new")
      .col-sm-4
        .light-well
          %h4 用户
          .data
            = link_to admin_users_path do
              %h1= number_with_delimiter(User.count)
            %hr
            = link_to '新建用户', new_admin_user_path, class: "btn btn-new"
      .col-sm-4
        .light-well
          %h4 群组
          .data
            = link_to admin_groups_path do
              %h1= number_with_delimiter(Group.count)
            %hr
            = link_to '新建群组', new_admin_group_path, class: "btn btn-new"

    .row.prepend-top-10
      .col-md-4
        %h4 最近项目
        %hr
        - @projects.each do |project|
          %p
            = link_to project.name_with_namespace, [:admin, project.namespace.becomes(Namespace), project], class: 'str-truncated'
            %span.light.pull-right
              #{time_ago_with_tooltip(project.created_at)}

      .col-md-4
        %h4 最近用户
        %hr
        - @users.each do |user|
          %p
            = link_to [:admin, user], class: 'str-truncated' do
              = user.name
            %span.light.pull-right
              #{time_ago_with_tooltip(user.created_at)}

      .col-md-4
        %h4 最近群组
        %hr
        - @groups.each do |group|
          %p
            = link_to [:admin, group], class: 'str-truncated' do
              = group.name
            %span.light.pull-right
              #{time_ago_with_tooltip(group.created_at)}
